<template>
  <div class="wft-w-h-100">
    <van-stepper
      v-model="vModelValue"
      :min="attrs.min"
      :max="attrs.max"
      :step="attrs.step"
      :input-width="attrs.inputWidth"
      :button-size="attrs.buttonSize"
      :decimal-length="attrs.decimalLength"
      :disabled="attrs.disabled"
      :disable-plus="attrs.disablePlus"
      :disable-minus="attrs.disableMinus"
      :show-plus="attrs.showPlus"
      :show-minus="attrs.showMinus"
    />
  </div>
</template>
<script setup lang='ts'>
import { useAttrs, useTempValue } from 'generator/hooks'
import { ref, watch } from 'vue';

const props = defineProps<{
  panelJson: TPanel
  curComp: TComp
}>()

const vModelValue = ref(0)

const attrs = useAttrs(props.curComp.attrs)

const value = useTempValue(attrs, props.curComp, props.panelJson)

watch(() => value, () => {
  vModelValue.value = value.value
}, { deep: true, immediate: true })
</script>
<style scoped>
.wft-w-h-100 {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}
</style>